import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import JsonViewer from 'vue3-json-viewer'
//import 'vue3-json-viewer/dist/index.css'
import './assets/css/dark.css'; // 👈 引入深色样式
import App from './App.vue'
import router from './router';
import installSafeHtmlDirective from './directives/safeHtml';
// 引入 Pinia
import { createPinia } from 'pinia';
const pinia = createPinia();

const app = createApp(App)
// 使用 Pinia
app.use(pinia)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(ElementPlus)
app.use(JsonViewer);
app.use(router)
installSafeHtmlDirective(app);
app.mount('#app')

window.addEventListener('error', (e) => {
  if (e.message === 'ResizeObserver loop limit exceeded') {
    e.stopImmediatePropagation();
  }
});